package mt.dummy;

import java.io.Serializable;
import mt.Order;
import mt.comm.ServerSideMessage;


/**
 * ServerMessage are the messages sent from clients to the server.
 * @author Pedro, Rita, Miguel
 *
 */



public class ServerMessage implements ServerSideMessage, Serializable{

	private static final long serialVersionUID = -7278159892336970870L;

	/**
	 * The type of the Message. It may be: NEW_ORDER, CONNECTED, DISCONNECTED
	 */
	private final Type type;

	/**
	 * The name of the client who sends the message to the server.
	 */

	private final String senderNickname;

	/**
	 * The order of the message.
	 */

	private final Order order;


	/**
	 * Constructor. Constructs a message contains a type (enum), the nickname of the sender (String),
	 * and, depending on the message type, a new order.
	 * @param type
	 * @param senderNickname
	 * @param order
	 */
	public ServerMessage(Type type, String senderNickname, Order order){
		this.type=type;
		this.senderNickname=senderNickname;
		this.order=order;
	}


	@Override
	public Type getType() {
		// TODO Auto-generated method stub
		return type;
	}

	@Override
	public String getSenderNickname() {
		// TODO Auto-generated method stub
		return senderNickname;
	}

	@Override
	public Order getOrder() {
		// TODO Auto-generated method stub
		return order;
	}

}